package com.maxvision.mybatis.dto;

import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.List;


/**
 * 类说明
 *
 * @author HuangRongFu
 * @date 2022/10/17
 */

@Data
@TableName(value = "tb_student")
@AllArgsConstructor
@NoArgsConstructor
public class StudentDto extends BaseDto{

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    
    private String name;
    
    private Integer age;
    
    private String studentCard;
    
    @TableLogic
    private Integer deleteStatus;
    
    public void setAllManagerId(String managerId){
    
        setCreateBy(managerId);
        setUpdateBy(managerId);
    
    }
    
    public List<StudentDto> initData(){

        List<StudentDto> list = new ArrayList<>();
        for (int i = 0; i < 10; i++) {

            StudentDto studentDto = new StudentDto();
            studentDto.setId(RandomUtil.randomInt(10000));
            studentDto.setName(RandomUtil.randomString(3));
            studentDto.setAge(18);
            studentDto.setDeleteStatus(1);
            studentDto.setStudentCard(RandomUtil.randomNumbers(10));
            
            if (i % 3 == 0){
                
                studentDto = new StudentDto();
            }
            list.add(studentDto);
        }
        
        return list;
    }
    
    
}
